package com.example.server.config;

import com.example.server.service.RmiService;
import com.example.server.service.RmiServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiServiceExporter;

/**
 * @Author: YAOZUN
 * @Date: Created in 17:28 2018/12/16 0016
 * @Description:
 */
@Configuration
public class RmiServiceConfig {

    @Autowired
    @Qualifier("rmiServiceImpl")
    private RmiServiceImpl rmiServiceImpl;

    @Bean
    public RmiServiceExporter initRmiServiceExporter(){
        RmiServiceExporter exporter=new RmiServiceExporter();
        exporter.setServiceInterface(RmiService.class);
        exporter.setServiceName("rmiService");
        exporter.setService(rmiServiceImpl);
        exporter.setServicePort(6666);
        exporter.setRegistryPort(1099);
        return exporter;
    }

}
